//
//  YahooChatUser.m
//  HelloWorld
//
//  Created by Martin Le C. on 5/12/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "YahooChatUser.h"
NSInteger const MALE_ATTR	= 0x08000;
NSInteger const FEMALE_ATTR = 0x10000;
NSInteger const WEBCAM_ATTR = 0x00010;

@implementation YahooChatUser
@synthesize user;
@synthesize age;
@synthesize attributes;
@synthesize alias;
@synthesize location; 
-(id)init:(YahooUser*)yu at:(NSInteger)at al:(NSString*)al ag:(NSInteger)ag loc:(NSString*) loc {
	self.user = yu;
	self.attributes = at;
	self.age = ag;
	self.alias = al;
	self.location = loc;
	return self;
}
-(id)initWithupdate:(YahooUser*)yu at:(NSString*)at al:(NSString*)al ag:(NSString*)ag loc:(NSString*) loc {
	self.user = yu;
	[self update:at al:al ag:ag loc:loc];
	return self;
}
-(void)update:(NSString*)at al:(NSString*)al ag:(NSString*)ag loc:(NSString*)loc {
	NSInteger a,b;
	@try { 
		a= [at integerValue];
	} @catch (NSException *e) 
	{ 
		a=0; 
	}
	@try { 
		b= [at integerValue];
	} @catch (NSException *e) 
	{ 
		b=0; 
	}
	
	self.attributes=a;  
	self.age=b;  
	self.alias=al;  
	self.location=loc;
	
}
-(NSString*) toString {
	return [NSString stringWithFormat:@"user=[%@] age=%@ attributes=%x alias=%@ location=%@", self.user, self.age, self.attributes, self.alias, self.location];
}
@end